/* //不要给我WA WA 叫
//一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
#define x first
#define y second
using namespace std;
const int N = 2e5 + 10;
typedef pair<int,int> PII;
PII p[N];
//int a[N];
int dx[8] = {2,1,-1,-2,-2,-1,1,2};
int dy[8] = {1,2,2,1,-1,-2,-2,-1};
void solve()
{
    int n,m;
    cin >> n >> m;
    vector<vector<int>> vc(n,vector<int>(n,0));
    for(int i = 0; i < m; i++)
    {
        cin >> p[i].x >> p[i].y;
        vc[p[i].x - 1][p[i].y - 1] = 1;
    }
    int ans = m;
    for(int i = 0; i < 8; i++)
    {
         int x1 = p[0].x + dx[i];
         int y1 = p[0].y + dy[i];
         if(x1 >= 1 && x1 <= n && y1 <= n && y1 >= 1)
         {
            vc[x1 - 1][y1 - 1] = 1;
            ans++;
         }
    }
    for(int i = 1; i < m; i++)
    {
         for(int k = 0; k < 8; k++)
         {
              int x3 = p[i].x + dx[k];
              int y3 = p[i].y + dy[k];
              if(x3 >= 1 && x3 <= n && y3 <= n && y3 >= 1 && vc[x3 - 1][y3 - 1] == 0)
              {
                  vc[x3 - 1][y3 - 1] = 1;
                  ans++;
              }
         }
    }
    cout << n * n - ans << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- )  solve();
    return 0;
}
 */
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
#define x first 
#define y second
using namespace std;


#define int long long

const int dx[8] = {2, 1, -1, -2, -2, -1, 1, 2};
const int dy[8] = {1, 2, 2, 1, -1, -2, -2, -1};

void solve() {
    int n, m;
    cin >> n >> m;

    vector<pair<int, int>> p(m); 
    unordered_set<string> visited;

    for (int i = 0; i < m; i++)
    {
        cin >> p[i].x >> p[i].y; 
        visited.insert(to_string(p[i].x) + "," + to_string(p[i].y));
    }

    int ans = m; 


    for (int i = 0; i < 8; i++)
     {
        int x1 = p[0].x + dx[i];
        int y1 = p[0].y + dy[i];
        if (x1 >= 1 && x1 <= n && y1 >= 1 && y1 <= n)
         {
            if (visited.insert(to_string(x1) + "," + to_string(y1)).y)
            {
                ans++;
            }
        }
    }

    for (int i = 1; i < m; i++) 
    {
        for (int k = 0; k < 8; k++) 
        {
            int x3 = p[i].x + dx[k];
            int y3 = p[i].y + dy[k];
            if (x3 >= 1 && x3 <= n && y3 >= 1 && y3 <= n)
             {
                if (visited.insert(to_string(x3) + "," + to_string(y3)).y) 
                {
                    ans++;
                }
            }
        }
    }

    cout << n * n - ans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    while (t--) solve();
    return 0;
}
